/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.HashSet;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * <p>Project: javase - Stream5
 * <p>Powered by webrx On 2021-12-22 17:54:11
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream9 {
    public static void main(String[] args) {
        var ss = Stream.of(1, 2, 3, 4, 5, 2, 3);
        //java 16 ss.toList();
        var list = ss.filter(e -> e % 2 == 0).collect(Collectors.toList());
        System.out.println(list);

        //var set = ss.collect(Collectors.toSet());
        var set = new HashSet(list);
        System.out.println(set);


        var st = Stream.of(new Student(1, "lisi", 28, "男"), new Student(2, "jack", 38, "女"));
        //var map = st.collect(Collectors.toMap(Student::getName, Student::getAge));
        //System.out.println(map);

        var stname = st.map(Student::getName).collect(Collectors.joining(","));
        System.out.println(stname);

    }
}
